<html>
    <head>     
        <script type="text/javascript"
                src="http://maps.googleapis.com/maps/api/js?key=AIzaSyA6hN2FLhYMTOfCKQ9Orsyw4R6JF4GMeeE&sensor=true">
        </script>
        <script type="text/javascript">
            function loadMap() {
                var mapOptions = {
                    center: new google.maps.LatLng(10.878772,106.566662),
                    zoom: 16,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
                var map = new google.maps.Map(document.getElementById("map"), mapOptions);
                var myLatlng =  new google.maps.LatLng(10.878772,106.566662); 
                var marker = new google.maps.Marker({
                    position: myLatlng,
                    title: 'CÔNG TY SOPHA',
                    map: map,
                    draggable: false
                });
                var contentString =
                    '  <div style="width:400px;height:100px;background-color:#FFF;"><br/><br/>'
                    + '<center><h2><b><font style="color:#0066CC;">Công Ty Cổ Phần Bao Bì Nhựa SOPHA</font></b></h2></center>'
                    + '</div>';
                var infowindow = new google.maps.InfoWindow({
                    content: contentString
                });
                google.maps.event.addListener(marker, 'click', function () {
                    infowindow.open(map, marker);
                });                                                
            }
        </script>
        <?php
        $cs = Yii::app()->getClientScript();
        $baseUrl = Yii::app()->request->baseUrl;
        $cs->registerCssFile($baseUrl . '/css/contact.css');
        $cs->registerCssFile($baseUrl . '/css/contact-form.css');
        ?>
        <style type="text/css">
            #map{
                text-align:center;
                width:500px;
                height:500px;
                margin-left:8%;
                margin-top:20px;
                margin-bottom:50px;
                padding-left:10px;
                padding-right:10px;
                position:relative;
                border:1px solid #dfdfdf;
                border-radius:6px;
            }
        </style>
    </head>
    <body  onload="loadMap()">
        <div id="body_main">
            <div>
                <h2><?php echo Yii::t('contact', 'companyName'); ?> </h2>  
                <h4> <?php echo Yii::t('contact', 'address'); ?>: <?php echo Yii::t('contact', 'addressDetail'); ?><br/>
                    <?php echo Yii::t('contact', 'phone'); ?>:84.8.62598639 - Fax: 08.37103281<br/>
                    Email: baobinhua@sopha.com.vn Website: www.sopha.com.vn
                </h4>
            </div>
            <div id="map">
            </div>
            <div id="contact">
                <h2><?php echo Yii::t('contact', 'contactUs'); ?></h2>

                <?php if (Yii::app()->user->hasFlash('contact')): ?>
                    <div class="flash-success" style="padding-top: 10px;padding-bottom: 10px;">
                        <?php echo Yii::app()->user->getFlash('contact'); ?>
                    </div>
                <?php else: ?>
                    <p>
                        <?php echo Yii::t('contact', 'quote'); ?>
                    </p>
                    <div class="form">
                        <?php
                        $form = $this->beginWidget('CActiveForm', array(
                            'id' => 'contact-form',
                            'enableClientValidation' => true,
                            'clientOptions' => array(
                                'validateOnSubmit' => true,
                            ),
                                ));
                        ?>
                        <p class="note"><?php echo Yii::t('contact', 'fieldsWith'); ?> <span class="required">*</span> <?php echo Yii::t('contact', 'areRequired'); ?>.</p>

                        <?php echo $form->errorSummary($model); ?>

                        <div class="row">
                            <?php echo $form->labelEx($model, 'name'); ?>
                            <?php echo $form->textField($model, 'name'); ?>
                            <?php echo $form->error($model, 'name'); ?>
                        </div>

                        <div class="row">
                            <?php echo $form->labelEx($model, 'email'); ?>
                            <?php echo $form->textField($model, 'email'); ?>
                            <?php echo $form->error($model, 'email'); ?>
                        </div>

                        <div class="row">
                            <?php echo $form->labelEx($model, 'subject'); ?>
                            <?php echo $form->textField($model, 'subject', array('size' => 60, 'maxlength' => 128)); ?>
                            <?php echo $form->error($model, 'subject'); ?>
                        </div>

                        <div class="row">
                            <?php echo $form->labelEx($model, 'body'); ?>
                            <?php echo $form->textArea($model, 'body', array('rows' => 6, 'cols' => 50)); ?>
                            <?php echo $form->error($model, 'body'); ?>
                        </div>

                        <?php if (CCaptcha::checkRequirements()): ?>
                            <div class="row">
                                <?php echo $form->labelEx($model, 'verifyCode'); ?>
                                <div>
                                    <?php $this->widget('CCaptcha'); ?>
                                    <?php echo $form->textField($model, 'verifyCode'); ?>
                                </div>
                                <div class="hint"><?php echo Yii::t('contact', 'verifyCodeHelp1'); ?>
                                    <br/><?php echo Yii::t('contact', 'verifyCodeHelp2'); ?></div>
                                <?php echo $form->error($model, 'verifyCode'); ?>
                            </div>
                        <?php endif; ?>

                        <div class="row buttons">
                            <?php echo CHtml::submitButton(Yii::t('contact', 'submit')); ?>
                        </div>

                        <?php $this->endWidget(); ?>
                    </div><!-- form -->

                <?php endif; ?>
            </div>
        </div>
    </body>
</html>
